<?php
// $Id: config_manage_2.php 229 2008-03-03 13:27:42Z mikhail.miguel $

// 2007-08-01 K.OHWADA
// divid from index.php

//=========================================================
// WebLinks Module
// porting form RSSC 
// 2006-05-15 K.OHWADA
//=========================================================

include_once 'admin_header.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/debug.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/config_base_handler.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/config_define_handler.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/config_store_handler.php';
include_once WEBLINKS_ROOT_PATH.'/include/weblinks_version.php';
include_once WEBLINKS_ROOT_PATH.'/class/weblinks_config2_handler.php';
include_once WEBLINKS_ROOT_PATH.'/class/weblinks_config2_define_handler.php';
include_once WEBLINKS_ROOT_PATH.'/class/weblinks_linkitem_handler.php';
include_once WEBLINKS_ROOT_PATH.'/class/weblinks_linkitem_define_handler.php';
include_once WEBLINKS_ROOT_PATH.'/class/weblinks_linkitem_store_handler.php';
include_once WEBLINKS_ROOT_PATH.'/class/weblinks_config_check_handler.php';
include_once WEBLINKS_ROOT_PATH.'/admin/admin_config_class.php';

$DIR_CONFIG = WEBLINKS_ROOT_PATH.'/cache';

// class
$class_debug  =& happy_linux_debug::getInstance();
$config_form  =& admin_config_form::getInstance();
$config_store =& admin_config_store::getInstance();

$op = $config_form->get_post_get_op();

if ($op == 'save')
{
	if( !$config_form->check_token() ) 
	{
		xoops_cp_header();
		xoops_error("Token Error");
		echo "<br />\n";
		echo $config_form->get_token_error(1);
		echo "<br />\n";
	}
	else
	{
		$ret = $config_store->save_config();
		if ($ret)
		{
			redirect_header("config_manage_2.php", 1, _WLS_DBUPDATED);
		}
		else
		{
			xoops_cp_header();
			xoops_error("DB Error");
			echo $config_store->getErrors(1);
		}
	}
}
else
{
	xoops_cp_header();
}

$config_store->print_style_sheet();

weblinks_admin_print_header();
weblinks_admin_print_menu();
$config_form->print_menu_2();

$config_form->set_submit_value( _WEBLINKS_UPDATE );
$config_form->init_form();

echo '<a name="form_acess"></a>'."\n";
echo "<h4>"._WEBLINKS_ADMIN_AUTH."</h4>\n";
echo "<ul><li>"._WEBLINKS_ADMIN_AUTH_TEXT."</li></ul><br />\n";
$config_form->show_form_auth( _WEBLINKS_ADMIN_AUTH );

echo '<a name="form_cat"></a>'."\n";
echo "<h4>"._WEBLINKS_ADMIN_CAT_SET."</h4>\n";
$config_form->show_by_catid( 2, _WEBLINKS_ADMIN_CAT_SET );

echo '<a name="form_view"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_CONF_VIEW."</h4>\n";
$config_form->show_by_catid( 3, _AM_WEBLINKS_CONF_VIEW );

echo '<a name="form_index"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_CONF_INDEX."</h4>\n";
$config_form->show_by_catid( 23, _AM_WEBLINKS_CONF_INDEX );

echo '<a name="form_cat_page"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_CONF_CAT_PAGE."</h4>\n";
$config_form->show_by_catid( 26, _AM_WEBLINKS_CONF_CAT_PAGE );

echo '<a name="form_topten"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_CONF_TOPTEN."</h4>\n";
$config_form->show_by_catid( 4, _AM_WEBLINKS_CONF_TOPTEN );

echo '<a name="form_seach"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_CONF_SEARCH."</h4>\n";
$config_form->show_by_catid( 5, _AM_WEBLINKS_CONF_SEARCH );

echo '<a name="form_style"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_CONF_HTML_STYLE."</h4>\n";
$config_form->show_by_catid( 33, _AM_WEBLINKS_CONF_HTML_STYLE );

echo '<a name="form_performance"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_CONF_PERFORMANCE."</h4>\n";
echo _AM_WEBLINKS_CONF_PERFORMANCE_DSC."<br /><br />\n";
$config_form->show_by_catid( 6, _AM_WEBLINKS_CONF_PERFORMANCE );

echo '<a name="form_bin"></a>'."\n";
echo "<h4>"._AM_WEBLINKS_FORM_BIN."</h4>\n";
echo _AM_WEBLINKS_FORM_BIN_DESC."<br /><br />\n";
$config_form->show_by_catid( 7, _AM_WEBLINKS_FORM_BIN );

xoops_cp_footer();
exit();
// --- main end ---

?>